package com.richard.myapplication.slideview;

import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.richard.myapplication.R;

import java.util.ArrayList;
import java.util.List;

/**
 * **************************************
 * 项目名称:My Application
 *
 * @Author wuzhiguo
 * 邮箱：wuzhiguo@ksjgs.com
 * 创建时间: 2020/6/16     7:25 PM
 * 用途:
 * **************************************
 */
public class MainActivitySlideView extends AppCompatActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_slide_view);
        HorizontalScrollSlideView ssv_content = findViewById(R.id.ssv_content);

        List<View> views = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(300, 300);
            TextView textView = new TextView(this);
            textView.setText("===哈哈哈哈===");
            textView.setLayoutParams(params);
            textView.setGravity(Gravity.CENTER);
            views.add(textView);
        }
        ssv_content.setContentViews(views);

        ssv_content.setOnSlideBottomListener(new HorizontalScrollSlideView.OnSlideBottomListener() {
            @Override
            public void onSlideBottom() {
                Log.e("onSlideBottom", "onSlideBottom");
                Toast.makeText(MainActivitySlideView.this, "加载更多", Toast.LENGTH_SHORT).show();
            }
        });
    }


}
